//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.library.uiframework.utils;

import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class ListUtils {
    public ListUtils() {
    }

    public static List removeItem(List list, int start, int count) {
        int size = list.size();
        if (start > size) {
            return list;
        }
        int endIndex = Math.min(size, start + count);
        for (int i = endIndex - 1; i >= start; i--) {
            list.remove(i);
        }
        return list;
    }

    public static boolean isEmpty(Collection list) {
        return list == null || list.size() == 0;
    }

    public static boolean isNotEmpty(Collection list) {
        return !isEmpty(list);
    }

    public static boolean equal(Collection one, Collection other) {
        return one != null && other != null ? (one.size() != other.size() ? false : one.containsAll(other) && other
            .containsAll(one)) : false;
    }

    public static <T> Set<T> union(Collection<T> a, Collection<T> b) {
        HashSet result = new HashSet(a);
        result.addAll(b);
        return result;
    }

    public static <T> Set<T> intersection(Collection<T> a, Collection<T> b) {
        HashSet result = new HashSet(a);
        result.retainAll(b);
        return result;
    }

    public static <T> Set<T> difference(Collection<T> a, Collection<T> b) {
        HashSet result = new HashSet(a);
        result.removeAll(b);
        return result;
    }

    public static <T> Set<T> complement(Collection<T> a, Collection<T> b) {
        return difference(union(a, b), intersection(a, b));
    }
}
